<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var a = 0;
        console.log(Boolean(a));
        // Boolean会把非0的数字转化为true，0转换为false
        var b = '0';
        console.log(Boolean(b));
        // Boolean会把非空字符串转换为true，空字符串转换为false
        var c;
        console.log(Boolean(c));
        // Boolean会把申明但没有赋值的变量转换为false
        var d = null;
        console.log(Boolean(d));
        // Boolean会把null值转换为false
        var f = Number('asd');
        console.log(Boolean(f));
        // Boolean会把NaN数字类型转换为false

        // 在布尔的世界里,除了0,'',undefined,null,NaN之外，其他的都是true
    </script>
</body>
</html>